const clientFacade = require('../../app/facade/client.facade.js');
const _ =require('lodash');

module.exports = {
    addClient:addClient,
    getClientByCname:getClientByCname
}

function addClient(req, res, next) {
    let client = req.body;
    clientFacade.addClient(client, (error, result)=>{
        if(error) {
            return next(new Error(error));
        }else {
            return res.json(result);
        }
    })
}

function getClientByCname(req, res, next) {
    let cname = req.params.cname;
    console.log(cname);
    clientFacade.getClientByCname(cname, (error, result)=>{
        if(error) {
            return next(new Error(error));
        }else {
            return res.json(result);
        }
    })
}

